package com.wzy.level.user.userServlet;

import com.wzy.Jdbc封装.pojo.News_detail;
import com.wzy.Jdbc封装.pojo.News_user;
import com.wzy.level.detail.detailService.detailService;
import com.wzy.level.detail.detailServiceImpl.detailServiceImpl;
import com.wzy.level.detail.detailServlet.detail;
import com.wzy.level.user.userService.userService;
import com.wzy.level.user.userServiceImpl.userServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@WebServlet("/user_insert_updateServlet")
public class insert_updateServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        req.setCharacterEncoding("utf-8");
//        resp.setCharacterEncoding("utf-8");
        int id = Integer.parseInt(req.getParameter("id"));
        int state = Integer.parseInt(req.getParameter("state"));

       userService user = new userServiceImpl();
        News_user user1 = user.selectById(id);
        HttpSession session = req.getSession();
        session.setAttribute("user",user1);
        session.setAttribute("state",state);


        req.getRequestDispatcher("/system/user_form.jsp").forward(req,resp);
    }
}
